//
//  Utils.h
//  ssy
//
//  Created by 李志权 on 15/6/15.
//  Copyright (c) 2015年 深圳时时医科技有限公司. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "XMLWriter.h"
#import "AFNetworking.h"//AFNetworking网络请求
#import "AutoFadeWithLabel.h"//自动提示框
#import "HUD_SingleCase.h"//MBProgressHUD消息提示单例
#import <CommonCrypto/CommonDigest.h>//MD5
#import "SDNetImageView.h"
#import "UIView+UIVewCategory.h"
#import "ImageCompress.h"
#import "MJRefresh.h"
@interface Utils : NSObject

/** AFNetworking网络POST请求*/
+ (NSURLSessionDataTask *)POSTMethod:(NSString *)URLString
                          parameters:(id)parameters
                           isRespone:(BOOL)isRespone
                             success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
                             failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure;


/** AFNetworking网络GET HTTP请求*/
+(NSURLSessionDataTask *)GETRequest:(NSString *)URLString
                                                    parameters:(id)parameters
                                                       success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
                                                       failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure;
/**系统post请求*/
+(void)systemPOSTMethod:(NSString *)URLString Parameters:(NSString *)parameters success:(void (^)(NSURLSessionDataTask *task, id responseObject))success failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure;
/**打印字典*/
+ (void)logDic:(NSDictionary *)dic;

/** json对象转NSString*/
+ (NSString*)JsonObjectConvertNSString:(id)jsonObject;


/** 将字典或者数组转化为JSON串*/
+ (NSData*)JsonToData:(id)theData;


/** 将JSON串转化为字典或者数组*/
+ (id)JsonStringToArrayOrNSDictionary:(NSData*)jsonData;


/**
 @功能：解析网络json信息
 @参数：网络json信息字符串
 */
+ (id)parseJSON:(NSString*)strJSON;

/** 自动提示框*/
+ (void)alertMessage:(NSString*)message;


/** 判断UITextView CGSize*/
+ (CGSize)TakeTextViewSize:(UITextView*)txt;


/** 判断UIButton CGSize*/
+ (CGSize)TakeButtonSize:(UIButton*)btn;


/** 判断UILable CGSize*/
+ (CGRect)TakeHeight:(UILabel*)lbl;


/** 判断输入手机号码的合法性*/
+ (BOOL)isValidatePhone:(NSString*)phone;
/**判断银行卡是否合法*/
+(BOOL)checkCardNo:(NSString*)cardNo;
/** 判断输入验证码的时间是否过期*/
+ (BOOL)isValidateTimeOut:(NSString*)vdate;


/** 判断输入验证码的合法性*/
+ (BOOL)isValidateCode:(NSString*)code usercode:(NSString*)usercode;


/** 判断输入密码的合法性*/
+ (BOOL)isValidateTempPassword:(NSString*)TempPassword;


/** 判断两次输入密码是否相同*/
+ (BOOL)isValidateConfirmPassword:(NSString*)TempPassword ConfirmPassword:(NSString*)ConfirmPassword;


/** 利用正则表达式验证手机号码的合法性*/
+ (BOOL)ValidatePhone:(NSString *)phone;


//利用正则表达式验证邮箱的合法性
+ (BOOL)ValidateEmail:(NSString *)email;
/** MD5加密*/
+ (NSString *)md5:(NSString *)str;
/** MD5加密16大写*/
+ (NSString *)md516:(NSString *)str;
/**SHA1加密*/
+ (NSString*)sha1:(NSString *)str;
/**AES加密*/
+ (NSString *)AES128okey:(NSString *)key iv:(NSString *)iv content:(NSString *)content;
/**
 功能：画一条线
 参数：“top”：0，0，Width，0.5；“middle”：20，0，Width-20, 0.5；“bottom”：0, 49.5, Width, 0.5
 */
+ (UIView*)drawLine:(NSString*)type  height:(CGFloat)height;



+ (NSDate*)NSStringConvertNSDate:(NSString*)strDate format:(NSString*)format;


/** NSDate转NSString*/
+ (NSString*)NSDateConvertNSString:(NSDate*)date format:(NSString*)format;



/** NSDate转NSString*/
+ (NSString*)NSDateConvertNSString_Index:(NSString*)dateString format:(NSString*)format;




/** 把GMT日期转换成UTC*/
+ (NSDate*)getNowDateFromatAnDate:(NSDate *)anyDate;




/** 返回多久之前的时间*/
+ (NSString *)returnUploadTime:(NSString *)timeStr;
+ (NSString *)compareCurrentTime:(NSDate*)compareDate;
+(NSString *)compareDate:(NSString *)time;
/**获取时间戳*/
+(NSString *)getTime;



/** 秒数转时间*/
+ (NSString*)SecondsToTime:(long)timeInterval;




/** 是否显示网络加载菊花*/
+ (void)NetworkActivityIndicatorVisible:(BOOL)isShowOrHide;




/**
 因为要在UITableViewCell里面的UIView模块里面
 调用self.navigationcontroller pushviewcontroller推入一个新的ViewController，
 需要获取其上层的UIViewController
 */
+ (UIViewController*)GetSuperController:(UIView*)view;

/**获取当前屏幕显示的viewcontroller*/
+ (UIViewController *)getCurrentVC;

/** 图片压缩*/
+ (UIImage*)scaleImage:(UIImage *)image toScale:(float)scaleSize;



/** 遍历文件夹获得文件夹大小，返回多少M*/
+ (float)folderSizeAtPath:(NSString*)folderPath;



/** c语言获取单个文件大小*/
+ (long long)fileSizeAtPath:(NSString*)filePath;



/** OC获取单个文件大小,返回kb*/
+ (float)fileNSSizeAtPath:(NSString*)filePath;


/** 过滤html标签*/
+ (NSString*)HTMLFilter:(NSString*)description;



/** 获取网络当前时间*/
+ (NSDate *)getInternetDate;


/** 计算文本宽度*/
+ (CGRect)TakeWidth:(UILabel *)label;



/** 获取手机型号*/
+ (NSString*)getModel;

/**设置导航栏*/
+ (void)navigationBarReturn:(UIViewController *)VC color:(UIColor *)color font:(UIFont *)font foregroundColor:(UIColor *)foregroundColor;
/**修剪View角边*/
+ (void)shear:(UIView *)view;
/**判断对象是否为null，返回字符对象*/
+(NSString *)judgeObjectString:(id)str;
/**分段按钮*/
+(UISegmentedControl *)getUISegmentedArray:(NSArray *)array;
/**自适应键盘高度
 参数贴在控制器上的View
 控制器
 */
+ (void)startAdaptiveKeyboardInputView:(UIView *)view topView:(UIView *)topView;
/**输入结束隐藏键盘参数控制器**/
+(void)inputEndOfHiddenKeyboardTopView:(UIView *)topView;

/**HUD请等待*/
+(UIView *)getHUDView;
//照片获取本地路径转换
+(NSString *)getImagePath:(UIImage *)Image;
/** 选中后的颜色变化 */
+ (void)showClickedColor:(UIView *)clickedView;
/**结束刷新状态*/
+(void)endRefreshing:(UITableView *)tableView;
/**展示没数据*/
+(UILabel*)showNoData:(UIView *)superView;
/**获取UIStoryboardVC*/
+(UIViewController *)instantiateVCWithIdentifier:(NSString *)identifier;
/**设置导航栏*/
+(UIView *)setnavigationViewLeftBtn:(UIButton *)leftBtn rightBut:(UIButton *)rightBut title:(NSString *)tile superView:(UIView *)superView;
/**生成XML*/
+(NSString *)XMLStringFromDictionary:(NSDictionary *)dictionary keys:(NSArray *)keys;

/**左菜单点击*/
+ (void)leftMenuClickIndex:(NSString *)vType;
@end
